{% extends "base.html" %}

{% block content %}
<h1> 建立设备链接 </h1>

<form action="/conndevice.html" method="post">
  <div class="form-row">
    <div class="form-group col-md-6">
      <label for="address">Address</label>
      <input type="text" class="form-control" id="address" name="address">
    </div>
  </div>
  <div class="form-row">
    <div class="form-group col-md-6">
      <label for="rack">Rack</label>
      <input type="text" class="form-control" id="rack" name="rack">
    </div>
    <div class="form-group col-md-6">
      <label for="solt">Solt</label>
      <input type="text" class="form-control" id="solt" name="solt">
    </div>
  </div>
  <button type="submit" class="btn btn-primary">Connect</button>
</form>

{% endblock %}


{% block script %}
<script>
$(document).ready(function() {
        namespace = '/conn';
        var socket = io.connect(); // location.protocol + '//' + document.domain + ':' + location.port + namespace, {transports: ['websocket']}
        socket.on('server_response', function(res) {
            console.log(res.data);
        });
    });

</script>
{% endblock %}